import { Articles, createArticleInfo } from "@/type/article";
import request from "@/utils/request";

//获取文章列表
export const getArticles = (data: Articles) => {
  return request({
    url: "/articles",
    method: "get",
    params: data,
  });
};

//获取文章详情
export const getArticleDetail = (id: string) => {
  return request({
    url: `/articles/${id}`,
    method: "get",
  });
};

//创建文章
export const createArticle = (data: createArticleInfo) => {
  return request({
    url: "/articles",
    method: "post",
    data,
  });
};

//删除文章
export const deleteArticle = (id: string) => {
  return request({
    url: `/articles/${id}`,
    method: "delete",
  });
};
